#!/usr/bin/env python
# -*- coding:utf-8 -*-
from twisted.internet import reactor, protocol
from twisted.web.client import getPage
from twisted.internet import reactor
import time

class Echo(protocol.Protocol):

    def dataReceived(self, data):   #dataReceived方法是框架定义好的，名称不能改变
        self.transport.write(data)


factory = protocol.ServerFactory()
factory.protocol = Echo

# print type(reactor)
# import twisted.internet.selectreactor.SelectReactor
reactor.listenTCP(8000,factory)
reactor.run()